package com.cheng.example.atguigu.view2.client17;

import java.util.concurrent.atomic.AtomicReference;

public class Client17 {

    public static void main(String[] args) {
        User u1 = new User("u1", 17);
        User u2 = new User("u2", 18);

        AtomicReference<User> atomicReference = new AtomicReference<>();
        atomicReference.set(u1);

        System.out.println(atomicReference.compareAndSet(u1,u2));
        System.out.println(atomicReference.compareAndSet(u1,u2));
    }
}
